<template>
	<view class="main">
		<view class="br-top v-box dis-row">
			<view class="poser-index poser" :class="{'psvActive':current == navindex}" v-for="(navitem,navindex) in tabLiast" :key="navindex" @click="checkClick(navitem,navindex)">
				{{navitem.name}}<label v-if="current == navindex"></label>
			</view>
		</view>
		<!--顶部结束-->
		<block v-if="current == 0">
			<block v-if="contactsList.length>0">
			<!--list start-->
			<view class="master-block" v-for="(rsitem,rsindex) in contactsList" :key="rsindex">
				<view class="master-item">
					<view class="master-faceItem poser dis-row" @click="contactsNav(rsitem)">
						<!--头像处理start-->
						<view class="faceItem-ico">
							<image :src="rsitem.avatar?rsitem.avatar:'http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/1.jpg'"></image>
						</view>
						<!--头像处理over-->
						<!--顶部右侧标题文字开始-->
						<view class="faceText dis-clm">
							<!--置顶信息start-->
							<view class="faceText-t1 dis-row">
								<view class="master-name">{{rsitem.nickName}}</view>
								<block v-if="rsitem.isRealName == 1">
									<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/user-real.svg"></image></label>
									<text>实名认证</text>
								</block>
							</view>
							<!--置顶信息over-->
							<view class="master-userinfo dis-row">
								<text>{{rsitem.gender==1?'男':'女'}}</text>
								<text v-if="rsitem.age">{{rsitem.age}}岁</text>
								<text v-if="rsitem.nation">{{rsitem.nation}}</text>
							</view>
						</view>
						<!--顶部右侧标题文字结束-->
						<!--是否在线开始-->
						<view class="master-t3 dis-row">
							<block><view><label></label></view><text style="color: #43B729;">可用</text></block>
							<!-- <block><view><label style="background-color: #FF5964;"></label></view><text style="color: #FF5964;">不可用</text></block>
							<block>
								<view><label style="background-color: #0575FF;"></label></view><text style="color: #0575FF;">不好说</text>
							</block>
							<block><text style="color: #43B729;">未评价</text></block> -->
						</view>
						<!--是否在线结束-->
					</view>
					<!--标签列表开始-->
				    <view class="contacts-gouceng dis-row" @click="contactsNav(rsitem)">
						<block v-if="rsitem.staffType"><label>人员构成</label><text>{{rsitem.staffType}}</text></block>
						<block v-if="rsitem.workYear"><label>工龄</label><text>{{rsitem.workYear}}年</text></block>
						<block v-if="rsitem.mastery"><label>熟练度</label><text>{{rsitem.mastery}}</text></block>
					</view>
					<!--标签列表结束-->
					<!--底部开始哦-->
					<view class="master-zpList dis-clm poser" style="min-height:60rpx;">
						<view class="zpList-child dis-row">
							<view class="contacts-text">{{rsitem.skills?strHandle(rsitem.skills,','):'/'}}</view>
						</view>
						<view class="zpList-right dis-clm">
						   <view class="contacts-btns" @click="goutong(rsitem)">立即沟通</view>
						</view>
					</view>
					<!--底部结束-->
				</view>
			</view>
			<!--list over-->
		    </block>
			<block v-if="contactsList.length==0">
				<view class="empty-img">
					<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/icon50.png"></image>
					<label>暂无内容</label>
				</view>
			</block>
			
			
			
			
		</block>
		<block v-if="current == 1">
			<block v-if="contactsList.length>0">
			<!--list start-->
			<view class="master-block" v-for="(rsitem,rsindexs) in contactsList" :key="rsindexs">
				<view class="master-item">
					<view class="master-faceItem poser dis-row">
						<!--头像处理start-->
						<view class="faceItem-ico">
							<image :src="rsitem.avatar?rsitem.avatar:'http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/1.jpg'"></image>
						</view>
						<!--头像处理over-->
						<!--顶部右侧标题文字开始-->
						<view class="faceText dis-clm">
							<!--置顶信息start-->
							<view class="faceText-t1 dis-row" v-if="rsitem.isRealName == 1">
								<view class="master-name">{{rsitem.nickName}}</view>
								<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/user-real.svg"></image></label>
								<text>实名认证</text>
							</view>
							<!--置顶信息over-->
							<view class="master-userinfo dis-row">
								{{rsitem.gender==1?'男':'女'}}<text>|</text>{{rsitem.age}}岁<text>|</text>{{rsitem.nation}}
							</view>
						</view>
						<!--顶部右侧标题文字结束-->
						<!--是否在线开始-->
						<view class="master-t3 dis-row">
							<block><view><label></label></view><text style="color: #43B729;">可用</text></block>
							<!-- <block><view><label style="background-color: #FF5964;"></label></view><text style="color: #FF5964;">不可用</text></block>
							<block>
								<view><label style="background-color: #0575FF;"></label></view><text style="color: #0575FF;">不好说</text>
							</block>
							<block><text style="color: #43B729;">未评价</text></block> -->
						</view>
						<!--是否在线结束-->
					</view>
					<!--标签列表开始-->
				    <view class="contacts-gouceng dis-row" @click="contactsNav">
				    	<label>人员构成</label><text>{{rsitem.staffType}}</text>
				    	<label>工龄</label><text>{{rsitem.workYear}}年</text>
				    	<label>熟练度</label><text>{{rsitem.mastery}}</text>
				    </view>
					<!--标签列表结束-->
					<!--底部开始哦-->
					<view class="master-zpList dis-clm poser" style="min-height:60rpx;">
						<view class="zpList-child dis-row">
							<view class="contacts-text">{{rsitem.skills?strHandle(rsitem.skills,','):'/'}}</view>
						</view>
						<view class="zpList-right dis-clm">
						   <view class="contacts-btns" style="width: 96rpx;" @click="huifu(rsitem)">恢复</view>
						</view>
					</view>
					<!--底部结束-->
				</view>
			</view>
			<!--list over-->
			</block>
			<block v-if="contactsList.length == 0">
				<view class="empty-img">
					<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/icon50.png"></image>
					<label>暂无内容</label>
				</view>
			</block>
		</block>
	</view>
</template>

<script>
import Index from "@/common/index-model.js"	
let index = new Index()
let that = null
export default {
	data() {
		return {
			tabLiast:[
				{name:'全部',type:0},
				{name:'找回',type:1}
			],
			current:0,
			contactsList:[]
		}
	},
	methods: {
		strHandle(str,char=','){
			return index.strTrim(str,char);
		},
		goutong(rsitem) {
			let url='/pagesB/hxIm/index?user='+rsitem.hxName
			index.navigate_to(url)
		},
		huifu(rsitem) {
			index.getPublicUserMember({"tartgetId":rsitem.id},'client/collectCard/add','post',res=>{
				if(res.data.code == 200 && res.data.success){
					index.show_tips('恢复成功')
					this.getContactsList(this.tabLiast[this.current].type)
				}else{
					index.show_tips(res.data.message)
					return false
				}
			})
		},
		checkClick(item,index) {
			this.current = index
			this.getContactsList(item.type)
		},
		//跳转到详情页
		contactsNav(item) {
			let url="./contactsInfo?id="+item.id
			index.navigate_to(url)
		},
		//名片夹
		getContactsList(type) {
			this.contactsList = []
			let url="client/collectCard/list/"+type
			index.getPublicUserMember({},url,'get',res=>{
				if(res.data.code == 200 && res.data.success){
					this.contactsList = res.data.result
				}else{
					this.contactsList = []
				}
			})
		}
	},
	onLoad() {
		this.getContactsList(0)
	}
}
</script>

<style>
@import url("@/static/css/publics.css");	
@import url("@/static/css/mybrowse.css");
@import url("@/static/css/myBeInterested.css");	
@import url("@/static/css/mycontacts.css");
</style>